package ${JarName}.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

import org.springframework.beans.BeanUtils;
import com.itfreer.form.api.JdbcBaseEntity;
import ${JarName}.entity.${ClassName}Entity;

/**
 * 定义${ClassAliseName}实体
 */
 @Entity(name = "${TableName}")
public class Jdbc${ClassName}Entity implements JdbcBaseEntity<${ClassName}Entity>, Serializable  {
	private static final long serialVersionUID = 4673423560339517162L;
<#list tableFields as item>
<#if item.dataType?? >
	<#if (item.dataType == "STRING" || item.dataType == "CHAR" || item.dataType == "TEXT") >
	
	/**
	 * ${item.aliasName}
	 */
	<#if item.maxlen?? >
		<#if item.key?? >
			<#if item.key==true >
	@Id
			</#if>
		</#if>
	@Column(name = "${item.fieldName}", length = ${item.maxlen}, nullable = true)
	<#else>
	@Column(name = "${item.fieldName}", nullable = true)
	</#if>
	private String ${item.name?uncap_first};
	
	<#elseif (item.dataType == "INT16" || item.dataType == "INT" || item.dataType == "INT64" || item.dataType == "UINT16" || item.dataType == "UINT" || item.dataType == "UINT64") >
	/**
	 * ${item.aliasName}
	 */
	@Column(name = "${item.fieldName}", nullable = true)
	private Integer ${item.name?uncap_first};
	
	<#elseif (item.dataType == "DECIMAL" || item.dataType == "DOUBLE" || item.dataType == "SINGLE") >
	/**
	 * ${item.aliasName}
	 */
	@Column(name = "${item.fieldName}", nullable = true)
	private Double ${item.name?uncap_first};
	
	<#elseif item.dataType == "DATE">
	/**
	 * ${item.aliasName}
	 */
	@Column(name = "${item.fieldName}", nullable = true)
	private java.util.Date ${item.name?uncap_first};
	
	<#elseif item.dataType == "DATETIME">
	/**
	 * ${item.aliasName}
	 */
	@Column(name = "${item.fieldName}", nullable = true)
	private java.util.Date ${item.name?uncap_first};
	
	<#elseif item.dataType == "NODEFAULT">
	/**
	 * ${item.aliasName}
	 */
	@Column(name = "${item.fieldName}", nullable = true)
	private void ${item.name?uncap_first};
	
	<#elseif item.dataType == "BYTEARRAY">
	/**
	 * ${item.aliasName}
	 */
	@Column(name = "${item.fieldName}", nullable = true)
	private Byte[] ${item.name?uncap_first};
	
	<#elseif item.dataType == "BOOLEAN">
	/**
	 * ${item.aliasName}
	 */
	@Column(name = "${item.fieldName}", nullable = true)
	private Boolean ${item.name?uncap_first};
	
	<#else>
	 /**
	 * ${item.aliasName}
	 */
	@Column(name = "${item.fieldName}", nullable = true)
	private void ${item.name?uncap_first};
	
	</#if> 
<#else>
	/**
	 * ${item.aliasName}
	 */
	@Column(name = "${item.fieldName}", nullable = true)
	private void ${item.name?uncap_first};
</#if>
</#list> 

<#list tableFields as item>
<#if item.dataType?? >
	<#if (item.dataType == "STRING" || item.dataType == "CHAR" || item.dataType == "TEXT") >
	/**
	 * ${item.aliasName}
	 */
	public String get${item.name?cap_first}() {
		return ${item.name?uncap_first};
	}

	/**
	 * ${item.aliasName}
	 */
	public void set${item.name?cap_first}(String value) {
		this.${item.name?uncap_first} = value;
	}
	<#elseif (item.dataType == "INT16" || item.dataType == "INT" || item.dataType == "INT64" || item.dataType == "UINT16" || item.dataType == "UINT" || item.dataType == "UINT64") >
	/**
	 * ${item.aliasName}
	 */
	public Integer get${item.name?cap_first}() {
		return ${item.name?uncap_first};
	}

	/**
	 * ${item.aliasName}
	 */
	public void set${item.name?cap_first}(Integer value) {
		this.${item.name?uncap_first} = value;
	}
	<#elseif (item.dataType == "DECIMAL" || item.dataType == "DOUBLE" || item.dataType == "SINGLE") >
	/**
	 * ${item.aliasName}
	 */
	public Double get${item.name?cap_first}() {
		return ${item.name?uncap_first};
	}

	/**
	 * ${item.aliasName}
	 */
	public void set${item.name?cap_first}(Double value) {
		this.${item.name?uncap_first} = value;
	}
	<#elseif item.dataType == "DATE">
	/**
	 * ${item.aliasName}
	 */
	public java.util.Date get${item.name?cap_first}() {
		return ${item.name?uncap_first};
	}

	/**
	 * ${item.aliasName}
	 */
	public void set${item.name?cap_first}(java.util.Date value) {
		this.${item.name?uncap_first} = value;
	}
	<#elseif item.dataType == "DATETIME">
	/**
	 * ${item.aliasName}
	 */
	public java.util.Date get${item.name?cap_first}() {
		return ${item.name?uncap_first};
	}

	/**
	 * ${item.aliasName}
	 */
	public void set${item.name?cap_first}(java.util.Date value) {
		this.${item.name?uncap_first} = value;
	}
	<#elseif item.dataType == "NODEFAULT">
	 /**
	 * ${item.aliasName}
	 */
	public void get${item.name?cap_first}() {
		return ${item.name?uncap_first};
	}

	/**
	 * ${item.aliasName}
	 */
	public void set${item.name?cap_first}(void value) {
		this.${item.name?uncap_first} = value;
	}
	<#elseif item.dataType == "BYTEARRAY">
	 /**
	 * ${item.aliasName}
	 */
	public Byte[] get${item.name?cap_first}() {
		return ${item.name?uncap_first};
	}

	/**
	 * ${item.aliasName}
	 */
	public void set${item.name?cap_first}(Byte[] value) {
		this.${item.name?uncap_first} = value;
	}
	
	<#elseif item.dataType == "BOOLEAN">
	/**
	 * ${item.aliasName}
	 */
	public Boolean get${item.name?cap_first}() {
		return ${item.name?uncap_first};
	}

	/**
	 * ${item.aliasName}
	 */
	public void set${item.name?cap_first}(Boolean value) {
		this.${item.name?uncap_first} = value;
	}
	
	<#else>
	 /**
	 * ${item.aliasName}
	 */
	public void get${item.name?cap_first}() {
		return ${item.name?uncap_first};
	}

	/**
	 * ${item.aliasName}
	 */
	public void set${item.name?cap_first}(void value) {
		this.${item.name?uncap_first} = value;
	}
	</#if> 
<#else>
	/**
	 * ${item.aliasName}
	 */
	public void get${item.name?cap_first}() {
		return ${item.name?uncap_first};
	}

	/**
	 * ${item.aliasName}
	 */
	public void set${item.name?cap_first}(void value) {
		this.${item.name?uncap_first} = value;
	}
</#if>
</#list>

	@Override
	public void from(${ClassName}Entity t) {
		BeanUtils.copyProperties(t, this);
	}

	@Override
	public ${ClassName}Entity toEntity() {
		${ClassName}Entity toEntity = new ${ClassName}Entity();
		BeanUtils.copyProperties(this, toEntity);
		return toEntity;
	}
}